// 队列，满足FIFO（先进先出）
class Queue {
  private queue: any[];
  constructor() {
    this.queue = [];
  }
  public get(): any {
    return this.queue.shift();
  }
  public size(): number {
    return this.queue.length;
  }
  public put<T>(item: T): T {
    this.queue.push(item);
    return item;
  }
}

const q = new Queue();

const m = q.put((x: number, y: number): number => {
  return x + y;
});

const n = q.put((str: string): string => {
  return str;
});

console.log(m === q.get());
console.log(n === q.get());
